package com.pms.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.stereotype.Repository;

import com.pms.dao.EmployeeLeaveDao;
import com.pms.pojo.Department;
import com.pms.pojo.EmpLeave;
import com.pms.pojo.Employees;
import com.pms.pojo.LeaveEmployee;
import com.pms.pojo.LeaveQueryRequire;
import com.pms.pojo.Post;
import com.pms.pojo.Require;

@Repository("employeeLeaveDao")
public class EmployeeLeaveDaoImpl implements EmployeeLeaveDao{
	
	private  SqlSessionTemplate  sqlSessionTemplete;

	public void setSqlSessionTemplete(SqlSessionTemplate sqlSessionTemplete) {
		this.sqlSessionTemplete = sqlSessionTemplete;
	}
	
	public List<LeaveEmployee> getEmployeeLeave(LeaveQueryRequire Lrequire) {
		String statement="com.pms.dao.EmployeeLeaveDao.getEmployeeLeave";
		return this.sqlSessionTemplete.selectList(statement,Lrequire);
	}

	@Override
	public List<Department> getDepartments() {
		String statement="com.pms.dao.EmployeeLeaveDao.getDepartments";
		return this.sqlSessionTemplete.selectList(statement);
	}

	@Override
	public List<Post> getPost() {
		String statement="com.pms.dao.EmployeeLeaveDao.getPost";
		return this.sqlSessionTemplete.selectList(statement);
	}
	
	@Override
	public List<Department> getDepartment() {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.EmployeeLeaveDao.getDepartment";
		
		return this.sqlSessionTemplete.selectList(statement);
	}

	@Override
	public List<Employees> getRequireEmployees(Require require) {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.EmployeeLeaveDao.getRequireEmployees";
		
		return this.sqlSessionTemplete.selectList(statement, require);
	}

	@Override
	public void updateEmployee(EmpLeave empLeave) {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.EmployeeLeaveDao.updateEmployee";
		this.sqlSessionTemplete.update(statement, empLeave);
	}

	@Override
	public void addDeptTransfer(EmpLeave empLeave) {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.EmployeeLeaveDao.addDeptTransfer";
		this.sqlSessionTemplete.insert(statement, empLeave);
	}

	@Override
	public List<Employees> getEmployees() {
		// TODO Auto-generated method stub
		String statement="com.pms.dao.EmployeeLeaveDao.getEmployees";
		
		return this.sqlSessionTemplete.selectList(statement);
	}
}
